<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      *{
        margin: 0;
        padding: 0; 
      }
      .box {
        position: absolute;
        left: calc(50% - 200px);
        top: calc(50% - 200px);
        display: flex;
        flex-wrap: wrap;
        width: 400px;
        /* height: 250px; */
        /* background-color: pink; */
      }
      .box div {
        box-sizing: border-box;
        width: 50px;
        height: 50px;
      }
    </style>
  </head>
  <body>
    <script>
      document.write(`<div class=box>`);
      for (var i = 0; i < 8; i++) {
        for (var j = 0; j < 8; j++) {
          if ((i % 2 != 0 && j % 2 == 0) || (i % 2 == 0 && j % 2 != 0)) {
            document.write(`<div style="background:#792F1B;border:1px solid #000;"></div>`);
          } else {
            document.write(`<div style="background:#FFEDCD;border:1px solid #000;"></div>`);
          }
        }
      }
      document.write(`</div>`);
    </script>
  </body>
</html>
